var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
    })(e, t);
}, function(e, t) {
    function a() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (a.prototype = t.prototype, 
    new a());
}), a = this && this.__decorate || function(e, t, o, a) {
    var i, n = arguments.length, r = n < 3 ? t : null === a ? a = Object.getOwnPropertyDescriptor(t, o) : a;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, o, a); else for (var c = e.length - 1; 0 <= c; c--) (i = e[c]) && (r = (n < 3 ? i(r) : 3 < n ? i(t, o, r) : i(t, o)) || r);
    return 3 < n && r && Object.defineProperty(t, o, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("GameData"), s = e("LoadManager"), c = e("Global"), l = cc._decorator, d = l.ccclass, u = l.property, p = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.sprite = null, e.pet = null, e.nameLabel = null, e.diamondLabel = null, 
        e.moneyLabel = null, e.pieceLabel = null, e.layout = null, e.label = null, e;
    }
    return i(e, t), e.prototype.start = function() {}, e.prototype.init = function(t) {
        switch (t.type) {
          case 0:
            this.showAlready();
            break;

          case 1:
            var e;
            this.showReward(), !isNaN(t.personIdx) && 0 < (e = c.G.personModelList.filter(function(e) {
                return e.id == t.personIdx;
            })).length ? -1 < r.GD.skins.indexOf(t.personIdx) ? (this.sprite.node.active = !1, 
            isNaN(t.diamond) ? t.diamond = e[0].cost : t.diamond += e[0].cost) : (this.sprite.node.active = !0, 
            s.default.getInstance().loadSpriteFrame({
                url: "image/skin/" + t.personIdx,
                sprite: this.sprite
            }), this.nameLabel.string = e[0].m) : this.sprite.node.active = !1, t.pet ? this.pet.active = !0 : this.pet.active = !1, 
            isNaN(t.diamond) ? this.diamondLabel.node.parent.active = !1 : (this.diamondLabel.node.parent.active = !0, 
            this.diamondLabel.string = GA.formatNumber(t.diamond)), isNaN(t.money) ? this.moneyLabel.node.parent.active = !1 : (this.moneyLabel.node.parent.active = !0, 
            this.moneyLabel.string = GA.formatNumber(t.money)), isNaN(t.piece) ? this.pieceLabel.node.parent.active = !1 : (this.pieceLabel.node.parent.active = !0, 
            this.pieceLabel.string = GA.formatNumber(t.piece));
        }
    }, e.prototype.showReward = function() {
        this.layout.active = !0, this.label.node.active = !1;
    }, e.prototype.showAlready = function() {
        this.layout.active = !1, this.label.node.active = !0;
    }, a([ u(cc.Sprite) ], e.prototype, "sprite", void 0), a([ u(cc.Node) ], e.prototype, "pet", void 0), 
    a([ u(cc.Label) ], e.prototype, "nameLabel", void 0), a([ u(cc.Label) ], e.prototype, "diamondLabel", void 0), 
    a([ u(cc.Label) ], e.prototype, "moneyLabel", void 0), a([ u(cc.Label) ], e.prototype, "pieceLabel", void 0), 
    a([ u(cc.Node) ], e.prototype, "layout", void 0), a([ u(cc.Label) ], e.prototype, "label", void 0), 
    a([ d ], e);
}(cc.Component);

n.default = p;